<?php


namespace App\Services;


use App\Models\AdminUser;
use App\Tools\RedisTools;

class UserInfoService
{
    /**
     * @Notes:通过wx_open_id获取用户信息
     * @Author:Planb,
     * @Date: 2022/11/28,
     * @Time: 20:09,
     */
    public static function getUserInfo($wxOpenId){
        $redis = (RedisTools::getInstance())->connectRedis();
        $password = $redis->hGet('adminInfo',$wxOpenId);
        $password = base64_decode($password);
        $userInfo = AdminUser::where('wx_open_id',$wxOpenId)->first();
        if ($userInfo){
            return ['username'=>$userInfo['username'],'password'=>$password];
        }else{
            return false;
        }
    }
}
